home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2a.lha / p4-1.2a / lib / p4_sock_util.h < prev    next >
C/C++ Source or Header  |  1992-10-19  |  996b  |  53 lines

  1. #ifdef CAN_DO_SOCKET_MSGS
  2. #include <sys/socket.h>
  3. #endif
  4. #include <netdb.h>
  5.  
  6. #ifdef P4BSD
  7. #include <sys/wait.h>
  8. #include <sys/resource.h>
  9. #endif
  10.  
  11. #ifdef CAN_DO_SETSOCKOPT
  12. #include <netinet/tcp.h>
  13. #endif
  14.  
  15. #define NET_RECV_GOOD 0
  16. #define NET_RECV_EOF  -1    
  17.  
  18. #define NET_EXEC 1
  19. #define NET_DONE 2
  20. #define NET_RESPONSE 3
  21.  
  22. #define SOCK_BUFF_SIZE 4096
  23.  
  24. #define UNRESERVED_PORT 5001
  25.  
  26. struct net_message_t 
  27. {
  28.     int type:32;
  29.     int port:32;
  30.     int success:32;
  31.     char pgm[256];
  32.     char host[128];
  33.     char am_slave[32];
  34.     char message[512];
  35. };
  36.  
  37. /* Definitions for system messages between slaves */
  38. /* Macros to convert from integer to net byte order and vice versa */
  39. #ifdef P4BSD
  40. #define p4_i_to_n(n)  (int) htonl( (u_long) n)
  41. #define p4_n_to_i(n)  (int) ntohl( (u_long) n)
  42. #endif
  43.  
  44. #ifdef P4SYSV
  45. #if defined(IPSC860)  &&  !defined(IPSC860_SOCKETS)
  46. #define p4_i_to_n(n)  (n)
  47. #define p4_n_to_i(n)  (n)
  48. #else
  49. #define p4_i_to_n(n)  (int) htonl(n)
  50. #define p4_n_to_i(n)  (int) ntohl(n)
  51. #endif
  52. #endif
  53.